/******* 图片轮播*******/
var slider = document.getElementsByClassName("termLi");
var btn = document.getElementsByClassName("slider-btn");
curLi = 1;
var liNum = 0;
auto();

function auto() {
	img = setInterval(changeImg, 3500);
}

function changeImg() {
	slider[curLi].className = "termLi disOn";
	btn[curLi].className = "slider-btn select";
	if(curLi == 0) {
		slider[1].className = "termLi none";
		slider[2].className = "termLi none";
		slider[3].className = "termLi none";
		btn[1].className = "slider-btn";
		btn[2].className = "slider-btn";
		btn[3].className = "slider-btn";
	} else if(curLi == 1) {
		slider[0].className = "termLi none";
		slider[2].className = "termLi none";
		slider[3].className = "termLi none";
		btn[0].className = "slider-btn";
		btn[2].className = "slider-btn";
		btn[3].className = "slider-btn";
	} else if(curLi == 2) {
		slider[0].className = "termLi none";
		slider[1].className = "termLi none";
		slider[3].className = "termLi none";
		btn[0].className = "slider-btn";
		btn[1].className = "slider-btn";
		btn[3].className = "slider-btn";
	} else {
		slider[0].className = "termLi none";
		slider[1].className = "termLi none";
		slider[2].className = "termLi none";
		btn[0].className = "slider-btn";
		btn[1].className = "slider-btn";
		btn[2].className = "slider-btn";
	}
	if(curLi == 3) curLi = 0;
	else curLi++;
}
//图片轮播中的按钮响应事件
btn[0].onmousemove = mouseMoveA;
btn[0].onmouseout = function() {
	auto();
}
btn[1].onmousemove = mouseMoveB;
btn[1].onmouseout = function() {
	auto();
}
btn[2].onmousemove = mouseMoveC;
btn[2].onmouseout = function() {
	auto();
}
btn[3].onmousemove = mouseMoveD;
btn[3].onmouseout = function() {
	auto();
}

function mouseMoveA() {
	clearInterval(img);
	slider[0].className = "termLi disOn";
	slider[1].className = "termLi none";
	slider[2].className = "termLi none";
	slider[3].className = "termLi none";
	btn[0].className = "slider-btn select";
	btn[1].className = "slider-btn";
	btn[2].className = "slider-btn";
	btn[3].className = "slider-btn";
	curLi = 1;
}

function mouseMoveB() {
	clearInterval(img);
	slider[0].className = "termLi none";
	slider[1].className = "termLi disOn";
	slider[2].className = "termLi none";
	slider[3].className = "termLi none";
	btn[0].className = "slider-btn";
	btn[1].className = "slider-btn select";
	btn[2].className = "slider-btn";
	btn[3].className = "slider-btn";
	curLi = 2;
}

function mouseMoveC() {
	clearInterval(img);
	slider[0].className = "termLi none";
	slider[1].className = "termLi none";
	slider[2].className = "termLi disOn";
	slider[3].className = "termLi none";
	btn[0].className = "slider-btn";
	btn[1].className = "slider-btn";
	btn[2].className = "slider-btn select";
	btn[3].className = "slider-btn";
	curLi = 3;
}

function mouseMoveD() {
	clearInterval(img);
	slider[0].className = "termLi none";
	slider[1].className = "termLi none";
	slider[2].className = "termLi none";
	slider[3].className = "termLi disOn";
	btn[0].className = "slider-btn";
	btn[1].className = "slider-btn";
	btn[2].className = "slider-btn";
	btn[3].className = "slider-btn select";
	curLi = 0;
}

/******* 新闻菜单*******/
var nli = document.getElementsByClassName("news-li");
var dis = document.getElementsByClassName("news-box");

nli[0].onmouseover = function() {
	nli[0].style.color = "#008AD2";
	nli[0].style.fontWeight = "bolder";
	nli[1].style.color = "#6D6E6F";
	nli[1].style.fontWeight = "normal";
	nli[2].style.color = "#6D6E6F";
	nli[2].style.fontWeight = "normal";
	dis[0].style.display = "block";
	dis[1].style.display = "none";
	dis[2].style.display = "none";
}
nli[1].onmouseover = function() {
	nli[0].style.color = "#6D6E6F";
	nli[0].style.fontWeight = "normal";
	nli[1].style.color = "#008AD2";
	nli[1].style.fontWeight = "bolder";
	nli[2].style.color = "#6D6E6F";
	nli[2].style.fontWeight = "normal";
	dis[0].style.display = "none";
	dis[1].style.display = "block";
	dis[2].style.display = "none";
}
nli[2].onmouseover = function() {
	nli[0].style.color = "#6D6E6F";
	nli[0].style.fontWeight = "normal";
	nli[1].style.color = "#6D6E6F";
	nli[1].style.fontWeight = "normal";
	nli[2].style.color = "#008AD2";
	nli[2].style.fontWeight = "bolder";
	dis[0].style.display = "none";
	dis[1].style.display = "none";
	dis[2].style.display = "block";
}

/*******教师介绍模块移动*******/
var introduce = document.getElementById("introduce");
var num = 1;
window.onload = startMove;

function startMove() {
	ulMove = setInterval(moveUl, 2500);
}

function moveUl() {
	if(num == 1) {
		introduce.style.left = "-297.5px"; //num=1时，ul向左移动
		num = 0;
	} else {
		introduce.style.left = "0"; //num=0时，ul向右移动回到最初的位置
		num = 1;
	}
}

var common = document.getElementsByClassName("common");
for(var i = 0; i < common.length; i++) {
	common[i].onclick = function() {
		clearInterval(ulMove); //点击左、右键取消ul的自动移动
		moveUl(); //点击移动ul
		startMove(); //重新启动ul自动移动
	}
}

var teacher = document.getElementsByClassName("teacher");
for(var j = 0; j < teacher.length; j++) {
	teacher[j].onmousemove = function() { //鼠标移动到某一个teacher块的时候取消ul自动移动
		clearInterval(ulMove);
	}
	teacher[j].onmouseout = function() { //鼠标离开某一个teacher块的时候重新启动ul自动移动
		startMove();
	}
}